self.onmessage=function(event){
    const {port,message}=event.data;
    console.log("线程B收到：",message);

    port.onmessage=function(e){
//        console.log(e);
        console.log("workerB收到来自WorkerA的消息：",e.data);
        if(e.data.type=="ping"){
            setTimeout(()=>{
                port.postMessage({type:"pong",message:"Hello from Worker B!",date:new Date()})
            },15000)

            // const data={
            //     "variables": {
            //         "worksIds": ["473704767", "455772929", "471488171", "473913525", "422093332", "458589126", "472995482", "476486645", "451997768", "478131024", "472986965", "474733924", "445076572", "478960119", "474525780", "471185703", "470071174", "410176352", "478191925", "478235012"]
            //     },
            //     "query": "\n          query getWorksList($worksIds: [ID!]) {\n            worksList(worksIds: $worksIds) {\n              \n      id\n      \n    \n    title\n    cover(useSmall: false)\n    url\n    isBundle\n    coverLabel(preferVip: true)\n  \n    \n  url\n  title\n\n    \n    author {\n      name\n      url\n    }\n    origAuthor {\n      name\n      url\n    }\n  \n    \n  abstract\n  authorHighlight\n  editorHighlight\n\n    \n    isEssay\n    \n    ... on EssayWorks {\n      favorCount\n    }\n  \n    \n    \n    averageRating\n    ratingCount\n    url\n    isColumn\n    isFinished\n  \n  \n  \n    kinds { \n    name @skip(if: true)\n    shortName @include(if: true)\n    id\n   }\n    highlightTags (variant: \"hotTags\"){ name }\n    \n    fanfiction { tags {name url} }\n    tags {name url}\n  \n    \n            }\n          }\n        ",
            //     "operationName": "getWorksList"
            // }
            // fetch("https://read.douban.com/j/graphql",{
            //     method: 'POST',
            //     headers: {
            //         'Content-Type': 'application/json'
            //     },
            //     body: JSON.stringify(data)
            // }).then(res=>{
            //     port.postMessage({type:"pong",message:"Hello from Worker B!",date:new Date(),data:res.data.worksList})
            // })
        }
    }
    port.postMessage({type:"pong",message:"Hello from Worker B!"});
}